package com.ruoyi.hqfinance.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.hqfinance.domain.HqFcSheet;
import com.ruoyi.hqfinance.domain.HqKuaiBaoSheet;
import com.ruoyi.hqfinance.domain.vo.HqPlatformBillSheetVo;
import com.ruoyi.hqfinance.service.HqPlatformBillSheetService;
import com.ruoyi.logistic.domain.PageInfo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/hq/togetherBusiness")
@Api(tags = "总部财务-平台账单报表")
public class HqPlatformBillSheetServiceController {
    @Autowired
    private HqPlatformBillSheetService hqPlatformBillSheetService;

    @ApiOperation("快宝面单")
    @PostMapping("/collectKB")
    public R collect(@RequestBody HqPlatformBillSheetVo vo){
        List<HqKuaiBaoSheet> sheetList = hqPlatformBillSheetService.collectKB(vo);
        if (sheetList == null || sheetList.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(PageInfo.info(sheetList));
        }
    }

    @ApiOperation("丰巢面单")
    @PostMapping("/collectFC")
    public R collectFC(@RequestBody HqPlatformBillSheetVo vo){
        List<HqFcSheet> hqFcSheets = hqPlatformBillSheetService.collectFC(vo);
        if (hqFcSheets == null || hqFcSheets.size() == 0) {
            return R.fail("暂无数据");
        } else {
            return R.ok(PageInfo.info(hqFcSheets));
        }
    }
}
